package com.ruoyi.product.controller;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.ruoyi.common.core.web.controller.ActionParamHandler;
import com.ruoyi.common.core.web.domain.BaseEntity;
//import com.ruoyi.common.utils.SecurityUtils;
import org.apache.commons.lang3.StringUtils;

public abstract class AbstractActionParamHandler<K, T extends BaseEntity> implements ActionParamHandler<K, T> {

//    protected   Long getCompanyDeptId() {
//        String ancestors = SecurityUtils.getLoginUser().getUser().getDept().getAncestors();
//
//        String companyDeptId = StringUtils.split(ancestors, ",")[1];
//        return Long.valueOf(companyDeptId);
//    }
    protected   Long getMerchantId() {

        return Long.valueOf(0);
    }
    protected  void setSort(){
        Page oldPage = PageHelper.getLocalPage();
        if (oldPage != null) {
            String orderBy = oldPage.getOrderBy();
            if (StringUtils.isBlank(orderBy)) {
                oldPage.setOrderBy("create_time DESC");
            }
        }
    }
}
